package cn.chenfeifx.example.examples;

import cn.chenfeifx.core.common.SimpleButton;
import cn.chenfeifx.core.controls.CFMessage;
import cn.chenfeifx.core.enums.Level;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;

//消息提示案例
public class CFMessageExample extends StackPane {

    SimpleButton p = new SimpleButton("Primary");
    SimpleButton s = new SimpleButton("Success", Level.SUCCESS);
    SimpleButton i = new SimpleButton("Info", Level.INFO);
    SimpleButton w = new SimpleButton("Warn", Level.WARN);
    SimpleButton d = new SimpleButton("Danger", Level.DANGER);

    HBox hBox = new HBox(p, s, i, w, d);

    public CFMessageExample() {
        getChildren().add(hBox);
        //
        hBox.setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE);
        hBox.setSpacing(20);
        p.setOnMouseClicked(event -> CFMessage.show("—春风杨柳万千条，六亿神州尽舜尧。"));// 这里传this只是为了获取到CFStage 中的组件
        s.setOnMouseClicked(event -> CFMessage.show("—春风杨柳万千条，六亿神州尽舜尧。", Level.SUCCESS));
        i.setOnMouseClicked(event -> CFMessage.show("—春风杨柳万千条，六亿神州尽舜尧。", Level.INFO));
        w.setOnMouseClicked(event -> CFMessage.show("—春风杨柳万千条，六亿神州尽舜尧。", Level.WARN));
        d.setOnMouseClicked(event -> CFMessage.show("—春风杨柳万千条，六亿神州尽舜尧。", Level.DANGER));
    }

}
